//
//  TCLYReservationTableViewCell.m
//  YuErmuYing
//
//  Created by LYang on 16/8/17.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "TCLYReservationTableViewCell.h"
#import "Masonry.h"

@implementation TCLYReservationTableViewCell

-(instancetype) initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor colorWithRed:244/255.0 green:244/255.0 blue:244/255.0 alpha:1];
        UIView * bgView = [[UIView alloc] init];
        bgView.backgroundColor = [UIColor whiteColor];
        [self addSubview:bgView];
        [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_top).offset(34/2.0);
            make.left.mas_equalTo(self);
            make.right.mas_equalTo(self);
            make.bottom.mas_equalTo(self);
        }];
        
        self.headerImageView = [[UIImageView alloc] init];
        [bgView addSubview:self.headerImageView];
        [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(7.5);
            make.left.mas_equalTo(8);
            make.width.mas_equalTo(197/2.0);
            make.height.mas_equalTo(209/2.0);
        }];
        self.nickNameLabel = [[UILabel alloc] init];
        self.nickNameLabel.font = [UIFont boldSystemFontOfSize:16];
        self.nickNameLabel.textColor = [UIColor blackColor];
        self.nickNameLabel.numberOfLines = 1;
        self.nickNameLabel.textAlignment = NSTextAlignmentLeft;
        [bgView addSubview:self.nickNameLabel];
        [self.nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.headerImageView.mas_right).offset(46/2);
            make.top.mas_equalTo(28/2);
            make.right.mas_equalTo(self.mas_right).offset(-12);
            make.height.mas_equalTo(20);
        }];
        self.instructionsLabel = [[UILabel alloc] init];
        
        self.instructionsLabel.numberOfLines = 0;
        self.instructionsLabel.textAlignment = NSTextAlignmentLeft;
        self.instructionsLabel.textColor = [UIColor colorWithRed:142/255.0 green:142/255.0 blue:142/255.0 alpha:1];
        self.instructionsLabel.font = [UIFont systemFontOfSize:12];
        [bgView addSubview:self.instructionsLabel];
        [self.instructionsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.nickNameLabel.mas_bottom).offset(20);
            make.left.mas_equalTo(self.nickNameLabel);
            make.right.mas_equalTo(self.mas_right).offset(-50);
            make.bottom.mas_equalTo(self.headerImageView);
        }];
        UIImageView * imageView = [[UIImageView alloc] init];
        imageView.backgroundColor = [UIColor blackColor];
        imageView.tag = 101;
        [bgView addSubview:imageView];
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.headerImageView.mas_bottom).offset(10);
            make.left.mas_equalTo(self);
            make.right.mas_equalTo(self);
            make.height.mas_equalTo(1);
        }];
        
        self.sumLabel = [[UILabel alloc] init];
        self.sumLabel.font = [UIFont boldSystemFontOfSize:16];
        self.sumLabel.textColor = [UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1];
        self.sumLabel.textAlignment = NSTextAlignmentCenter;
        [bgView addSubview:self.sumLabel];
        [self.sumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(imageView.mas_bottom).offset(0);
            make.right.mas_equalTo(bgView);
            make.width.mas_equalTo(100);
            make.height.mas_equalTo(30);
        }];
        
        UILabel * sum = [[UILabel alloc] init];
        sum.text = @"合计:";
        sum.textColor = [UIColor blackColor];
        sum.textAlignment = NSTextAlignmentCenter;
        sum.font = [UIFont systemFontOfSize:12];
        [bgView addSubview:sum];
        [sum mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.sumLabel);
            make.right.mas_equalTo(self.sumLabel.mas_left).offset(0);
            make.width.mas_equalTo(35);
            make.height.mas_equalTo(30);
        }];
        UIImageView * imageView1 = [[UIImageView alloc] init];
        imageView1.backgroundColor = [UIColor lightGrayColor];
        [bgView addSubview:imageView1];
        [imageView1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(sum.mas_bottom).offset(0);
            make.left.mas_equalTo(bgView);
            make.right.mas_equalTo(bgView);
            make.height.mas_equalTo(1);
        }];
        self.remindBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.remindBtn.titleLabel.font = [UIFont boldSystemFontOfSize:12];
        [self.remindBtn setTitle:@"提醒上门" forState:UIControlStateNormal];
        [self.remindBtn setTitleColor:[UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1] forState:UIControlStateNormal];
        [self.remindBtn setTitle:@"已经提醒" forState:UIControlStateSelected];
        
        
        [bgView addSubview:self.remindBtn];
        [self.remindBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(self);
            make.top.mas_equalTo(imageView1.mas_bottom).offset(0);
            make.width.mas_equalTo(171/2.0);
            make.height.mas_equalTo(64/2.0);
        }];
        
        self.remindBtn.layer.cornerRadius = 2;
        self.remindBtn.layer.masksToBounds = YES;
//        self.remindBtn.layer.borderColor = (__bridge CGColorRef _Nullable)([UIColor blackColor]);
        self.remindBtn.layer.borderColor = [UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1].CGColor;
        self.remindBtn.layer.borderWidth = 1;
        
        self.cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.cancelBtn.titleLabel.font = [UIFont boldSystemFontOfSize:12];
        [self.cancelBtn setTitleColor:[UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1] forState:UIControlStateNormal];
        [self.cancelBtn setTitle:@"取消订单" forState:UIControlStateNormal];
        
        self.cancelBtn.layer.cornerRadius = 2;
        self.cancelBtn.layer.masksToBounds = YES;
        self.cancelBtn.layer.borderColor = [UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1].CGColor;
        self.cancelBtn.layer.borderWidth = 1;
        
        [bgView addSubview:self.cancelBtn];
        [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.remindBtn);
            make.right.mas_equalTo(self.remindBtn.mas_left).offset(-10);
            make.width.mas_equalTo(self.remindBtn);
            make.height.mas_equalTo(self.remindBtn);
        }];
        
    }
    return self;
}
////代付款
//-(void) createPay{
//    self.payBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//    [self.payBtn setTitle:@"付款" forState:UIControlStateNormal];
//    [self.payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    self.payBtn.backgroundColor = [UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1];
//    [self addSubview:self.payBtn];
//    [self.payBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo([self viewWithTag:101].mas_bottom).offset(0);
//        make.right.mas_equalTo(self);
//        make.height.mas_equalTo(64/2.0);
//        make.width.mas_equalTo(171/2.0);
//    }];
//    
//    self.sumLabel = [[UILabel alloc] init];
//    self.sumLabel.font = [UIFont boldSystemFontOfSize:18];
//    self.sumLabel.textColor = [UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1];
//    self.sumLabel.textAlignment = NSTextAlignmentCenter;
//    [self addSubview:self.sumLabel];
//    [self.sumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.payBtn);
//        make.right.mas_equalTo(self.payBtn.mas_left).offset(-56/2.0);
//        make.width.mas_equalTo(80);
//        make.height.mas_equalTo(30);
//    }];
//    
//    UILabel * sum = [[UILabel alloc] init];
//    sum.text = @"合计:";
//    sum.textColor = [UIColor blackColor];
//    sum.textAlignment = NSTextAlignmentCenter;
//    sum.font = [UIFont systemFontOfSize:12];
//    [self addSubview:sum];
//    [sum mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.payBtn);
//        make.right.mas_equalTo(self.sumLabel.mas_left).offset(0);
//        make.width.mas_equalTo(35);
//        make.height.mas_equalTo(30);
//    }];
//    
//}
////待确认
//-(void) createConfirm{
//    self.serviceBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//    self.serviceBtn.backgroundColor = [UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1];
//    [self.serviceBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    [self addSubview:self.serviceBtn];
//    [self.serviceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo([self viewWithTag:101].mas_bottom).offset(0);
//        make.right.mas_equalTo(self);
//        make.height.mas_equalTo(64/2.0);
//        make.width.mas_equalTo(171/2.0);
//    }];
//    self.sumLabel = [[UILabel alloc] init];
//    self.sumLabel.font = [UIFont boldSystemFontOfSize:18];
//    self.sumLabel.textColor = [UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1];
//    self.sumLabel.textAlignment = NSTextAlignmentCenter;
//    [self addSubview:self.sumLabel];
//    [self.sumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.serviceBtn);
//        make.right.mas_equalTo(self.serviceBtn.mas_left).offset(-56/2.0);
//        make.width.mas_equalTo(80);
//        make.height.mas_equalTo(30);
//    }];
//    
//    UILabel * sum = [[UILabel alloc] init];
//    sum.text = @"合计:";
//    sum.textColor = [UIColor blackColor];
//    sum.textAlignment = NSTextAlignmentCenter;
//    sum.font = [UIFont systemFontOfSize:12];
//    [self addSubview:sum];
//    [sum mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.payBtn);
//        make.right.mas_equalTo(self.sumLabel.mas_left).offset(0);
//        make.width.mas_equalTo(35);
//        make.height.mas_equalTo(30);
//    }];
//    
//}
////待服务
//-(void)createService{
//    self.remindBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//    [self.remindBtn setTitle:@"提醒上门" forState:UIControlStateNormal];
//    [self.remindBtn setTitleColor:[UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1] forState:UIControlStateNormal];
//    self.remindBtn.layer.borderColor = (__bridge CGColorRef _Nullable)([UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1]);
//    self.remindBtn.layer.borderWidth = 1;
//    [self addSubview:self.remindBtn];
//    [self.remindBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.mas_equalTo(self);
//        make.top.mas_equalTo([self viewWithTag:101].mas_bottom).offset(0);
//        make.width.mas_equalTo(171/2.0);
//        make.height.mas_equalTo(64/2.0);
//    }];
//    
//    self.cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//    [self.cancelBtn setTitleColor:[UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1] forState:UIControlStateNormal];
//    [self.cancelBtn setTitle:@"取消订单" forState:UIControlStateNormal];
//    self.cancelBtn.layer.borderColor = (__bridge CGColorRef _Nullable)([UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1]);
//    self.cancelBtn.layer.borderWidth = 1;
//    [self addSubview:self.cancelBtn];
//    [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(self.remindBtn);
//        make.right.mas_equalTo(self.remindBtn.mas_left).offset(10);
//        make.width.mas_equalTo(self.remindBtn);
//        make.height.mas_equalTo(self.remindBtn);
//    }];
//    self.sumLabel = [[UILabel alloc] init];
//    self.sumLabel.font = [UIFont boldSystemFontOfSize:18];
//    self.sumLabel.textColor = [UIColor colorWithRed:239/255.0 green:25/255.0 blue:98/255.0 alpha:1];
//    self.sumLabel.textAlignment = NSTextAlignmentCenter;
//    [self addSubview:self.sumLabel];
//    [self.sumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.remindBtn);
//        make.right.mas_equalTo(self.cancelBtn.mas_left).offset(-56/2.0);
//        make.width.mas_equalTo(80);
//        make.height.mas_equalTo(30);
//    }];
//    
//    UILabel * sum = [[UILabel alloc] init];
//    sum.text = @"合计:";
//    sum.textColor = [UIColor blackColor];
//    sum.textAlignment = NSTextAlignmentCenter;
//    sum.font = [UIFont systemFontOfSize:12];
//    [self addSubview:sum];
//    [sum mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.sumLabel);
//        make.right.mas_equalTo(self.sumLabel.mas_left).offset(0);
//        make.width.mas_equalTo(35);
//        make.height.mas_equalTo(30);
//    }];
//    
//    
//}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
